package design.Component;

/**
 * Created by looper on 2017/8/17.
 */
public class Leaf extends Component {
  public Leaf(String name) {
    super(name);
  }

  @Override
  public void Add(Component component) {
    //叶子节点已经是最下面的了,不会再有子节点
    System.out.println("\t叶子节点不能添加子节点");
  }

  @Override
  public void Rmove(Component component) {
    //叶子节点不存在子节点,所以更不能说删除了
    System.out.println("\t叶子节点不能删除子节点");
  }

  @Override
  public void Display() {
    System.out.println("\t叶子节点: name = "+ name);
  }
}
